﻿@using CNav.Model
@using CNav.Support
@{
    var displayname = ViewData["DisplayName"] as string ?? "Guest";
    var user = (SessionUser)Session[Constant.SessionUser];
}

@if (Request.IsAuthenticated && user != null)
{
    <text>
    <span class="username">Hello, @Html.ActionLink(displayname, "Details", "UserProfile", routeValues: new { id = user.ID }, htmlAttributes: new { @class = "username", title = "Manage" })
        @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
        {
            @Html.AntiForgeryToken()
            <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
        }
    </span>
    </text>
}
else
{
    <ul>
        <li>@Html.ActionLink("Business Register", "Register", "RegisterBusiness", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
        <li>@Html.ActionLink("User Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
    </ul>
}